<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>商品详情</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/swiper.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/layer.css" />
    <link rel="stylesheet" type="text/css" href="../css/mdw.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/ShareSDK.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
    <script type="text/javascript" src="../script/clipboard.min.js"></script>
    <script type="text/javascript" src="../script/swiper.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/layer.js"></script>
    <script type="text/javascript" src="../script/mdw.js"></script>
    <script type="text/javascript" src="../script/jumpPage.js"></script>
</head>
<body>
    <header class="header wareHeader">
        <div class="backPrevPages" onclick="historyBack()"></div>
        <div class="headerTitle">
            <div onclick="onheightToTop('1')" class="titleItem on">商品<i></i></div>
            <div onclick="onheightToTop('2')" class="titleItem ">评价<i></i></div>
            <div onclick="onheightToTop('3')" class="titleItem ">详情<i></i></div>
            <!-- <div onclick="onheightToTop('4')" class="titleItem">推荐<i></i></div> -->
        </div>
        <div class="fx"></div>
        <div class="xiala"></div>
    </header>
    <section class="warePage HTML_BOX">
        <div id="ware_1" class=" bg-fff">
            <div class="ware_banner_swiper swiper-container">
                <div class="swiper-wrapper ware_banner">
                        <img src="../image/ware_banner.png" />
                </div>
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div class="wareBox1">
            <div class="wareTitle">
                <div id="wareTitle" class="wareName"></div>
                
            </div>
            <div id="wareInfo_price" class="warePrice"></div>
            <div class="waregz">购买此商品，你将获得<span class="score">25</span>积分</div>
            <!-- <div class="waregz">购买此商品，你将获得<span class="score">25</span>积分，相当于<span class="money">$0.05</span></div> -->
            <div id="wareps_tit" class="pstit f_c "></div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="wareBox2">
            <div class="boxItem1">
                <div class=""><span class="boxtitle">产地：</span><span id="zone">中国</span></div>
                <div class=""><span class="boxtitle">规格：</span><span id="guige">500g/盒</span></div>
            </div>
            <div class="boxItem2">
                <span class="boxtitle">简介：</span><span id="brief">广西芒果，产地在广西南宁</span>
            </div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="wareBox3 plr">
            <div class="boxItem1">
                <span class="boxtitle">配送方式</span>
                由<span class="ps1">Haveit</span>出售 | 由<span class="ps2">买到网</span>配送
            </div>
            <div class="boxItem2"  style="padding-bottom: .2rem;">
                <span class="boxtitle">送货/退货</span>
                <div class="boxUl">
                    <!-- <li><i></i>此商品最快可于落单后24小时内安排包装运输</li>
                    <li><i></i>此商品不可退货</li> -->
                    <p>•    此商品由 买到网 配送<br>
                        •   下午三点前确认订单，当天送达或寄出</p>
                </div>
            </div>
        </div>
        <div class="groupGuiZe plr tuangouShow ptgz dn">
            开团并邀请好友参团，人数不足自动退款，详见<span class="openGuiZe" onclick="openGuiZe();">拼团规则</span>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div class="groupWareBox plr tuangouShow dn">
            <div class="displayFlex warePageTitle">
                <div class="group_titles"><span id="group_pe">5</span>人在拼团，可直接参与</div>
                <div class="move groupALLOpen">查看全部<i class="icon"></i></div>
            </div>
            <ul id="groupList" class="groupUserCountList">
               <!--  <li>
                    <div class="groupUserItem1">
                        <div class="groupUserTx"><img src="../image/tx.png" /></div>
                        <div class="">187**8625</div>
                    </div>
                    <div class="groupUserItem1">
                        <div class="groupCount">
                            <div>还差<span class="c_main">2人</span>拼成</div>
                            <div class="surplus">剩余23:03:56</div>
                        </div>
                        <div class="gogroup f_c">去拼团</div>

                    </div>
                </li>
                <li>
                    <div class="groupUserItem1">
                        <div class="groupUserTx"><img src="../image/tx.png" /></div>
                        <div class="">187**8625</div>
                    </div>
                    <div class="groupUserItem1">
                        <div class="groupCount">
                            <div>还差<span class="c_main">2人</span>拼成</div>
                            <div class="surplus">剩余23:03:56</div>
                        </div>
                        <div class="gogroup f_c">去拼团</div>
                    </div>
                </li> -->
            </ul>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div id="ware_2" class="wareBox4 plr">
            <div class="warePageTitle">
                <div class="titleName"><span id="plEn">用户评价</span><div id="wareeva" class="evaLvl "></div><span id="comment_count" class="count">(0)</span></div>
                <div onclick="goComment();" class="move">查看全部<i class="icon"></i></div>
            </div>
            <ul class="evaList">
            <!-- <li>
                <div class="evaBox1 displayFlex">
                    <div class="userinfo">
                        <div class="userImg">
                            <img src="../image/tx.png" />
                        </div>
                        <div class="userName">187****2324</div>
                        <div class="evaLvl ">
                            <i class="on"></i>
                            <i class="on"></i>
                        </div>
                    </div>
                    <div>2018-9-9</div>
                </div>
                <div class="evaBox2">非常愉快的一次购物，收到的水果新鲜又大。更满意的是一个都没有坏哟~~</div>
                <div class="evaBox4">
                    <img src="../image/ware_2.png" />
                    <img src="../image/ware_3.png" />
                </div>
                <div class="evaBox5">2斤约12个</div>

            </li> -->

        </ul>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div id="ware_3" class="wareBox4 plr">
            <div class="warePageTitle">
                <div class="titleName"><span id="dlEn">商品详情</span></div>
            </div>
            <div class="wareContent">
                
            </div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
        <div id="ware_4" class="wareBox5 plr like_ware">
            <div class="ware_otherTitle"><span id="glEn">猜你喜欢</span> </div>
             <div class="like_swiper ware_swiper swiper-container">
                <div class="swiper-wrapper">

                </div>
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div  class="wareBox5 plr hot_ware">
            <div class="ware_otherTitle"><span id="hotEn">商家热销</span> </div>
             <div class="hot_swiper ware_swiper swiper-container">
                <div class="swiper-wrapper">

                </div>
                <div class="swiper-pagination"></div>
            </div>
        </div>
        <div class="bg-eee" style="border-bottom:.2rem solid #EEE ; "></div>
    </section>
    <section class="footer wareFooter displayFlex foot1">
        <div class="footLeft">
            <div class="kefu"><i></i><span>客服</span></div>
            <div class="favorite"><i></i><span>收藏</span></div>
            <div class="cart"><i></i><span>购物车</span></div>
        </div>
        <div class="addCart">加入购物车</div>
    </section>
    <section class="footer wareFooter displayFlex dn foot2">
        <div class="footLeft">
            <div class="kefu"><i></i><span>客服</span></div>
            <div class="favorite"><i></i><span>收藏</span></div>
            <div class="cart"><i></i><span>购物车</span></div>
        </div>
        <div class="displayFlex">
            <div class="alone_buy">
                <span>$0.00</span>
                <span>单独购买</span>
            </div>
            <div class="group_clear">
                <span>$0.00</span>
                <span>发起团购</span>
            </div>
        </div>
    </section>
    <!-- 弹窗 -->
    <div class="mask_pop">
        <div class="mask" ></div>
        <div class="wareGuigePop pop_Item dn">
            <div class="pop_close2"><i class="icon"></i></div>
            <div class="wareItem3 plr">
                <div class="wareItem_img">
                   <img id="son_img" src="../image/ware_1.png" />
                </div>
                <div class="wareName">
                   <div id="son_title">盼盼铜锣烧面包饼干550g/盒 </div>
                   <div id="son_price" class="warePrice"><span>$1265.00</span><del>$45.00</del></div>
                </div>
           </div>
           <div class="ggpopBox1">选择规格</div>
           <div class="ggpopBox2 plr">
               <ul class="guiGeList">

                </ul>
           </div>
           <div class="ggpopBox3 plr">
               <div class="pop_wareCount displayFlex">
                   <div>选择数量</div>
                   <div class="count_control">
                       <div class="btn reduce">-</div>
                       <div class="input"><input readonly="readonly" id="wareCount" value="1" type="number" /></div>
                       <div class="btn add">+</div>
                   </div>
               </div>
           </div>
           <div class="pop_submit f_c">确定</div>
        </div>
        <div class="groupGuiZe_pop pop_Item dn">
            <div class="pop_title">
                <span>拼团规则</span>
                <div class="pop_close2"><i class="icon"></i></div>
            </div>
            <div class="guize_content plr">
                <!-- <div class="guize_title plr">1.拼团条件</div>
                <div class="guize_count plr">购买商品人数达到最低成团人数。</div>
                <div class="guize_title plr">2.拼团有效期</div>
                <div class="guize_count plr">拼团有效期是自开团时刻起48小时之内，如果距离活动结束时间小于48小时，则以活动结束时间为准。</div>
                <div class="guize_title plr">3.拼团成功</div>
                <div class="guize_count plr">拼团有效期内支付的用户数达到参团人数，则拼团成功，商进入发货流程。</div>
                <div class="guize_title plr">4.拼团失败</div>
                <div class="guize_count plr">拼团有效期内未达到要求参团人数，则为拼团失败。</div> -->
            </div>

        </div>
        <div class="joinGroup_pop pop_Item dn">
            <div class="pop_title">
                <span>参与成和的团</span>
                <div class="pop_close2"><i class="icon"></i></div>
            </div>
            <div class=" gb_detailsBox2 f_c">
            <div class="msdjs">
                还剩下<span class="c_main">2个</span>名额，
                <span class="djstime hh">00</span>：
                <span class="djstime mm">00</span>：
                <span class="djstime ss">00</span>
                结束
            </div>
            </div>
            <ul class="groupUsetList">
                <li>
                    <div class="pinzhu">拼主</div>
                    <img src="../image/tx.png"/>
                </li>
                <li>
                    <img src="../image/tx.png"/>
                </li>
                <li>
                    <img src="../image/user_no.png"/>
                </li>
                <li>
                    <img src="../image/user_no.png"/>
                </li>
                <li>
                    <img src="../image/user_no.png"/>
                </li>
            </ul>
            <div data-id="0" id="ware_group" class="pageBtn fenxiang f_c">参与拼团</div>
        </div>
        <div class="groupAll_pop pop_Item dn">
            <div class="pop_title">
                <span>正在拼团</span>
                <div class="pop_close2"><i class="icon"></i></div>
            </div>
            <ul id="pop_groupList" class="groupUserCountList">
                <!-- <li class="plr">
                    <div class="groupUserItem1">
                        <div class="groupUserTx"><img src="../image/tx.png" /></div>
                        <div class="">187**8625</div>
                    </div>
                    <div class="groupUserItem1">
                        <div class="groupCount">
                            <div>还差<span class="c_main">2人</span>拼成</div>
                            <div class="surplus">剩余23:03:56</div>
                        </div>
                        <div class="gogroup f_c">去拼团</div>

                    </div>
                </li>
                <li class="plr">
                    <div class="groupUserItem1">
                        <div class="groupUserTx"><img src="../image/tx.png" /></div>
                        <div class="">187**8625</div>
                    </div>
                    <div class="groupUserItem1">
                        <div class="groupCount">
                            <div>还差<span class="c_main">2人</span>拼成</div>
                            <div class="surplus">剩余23:03:56</div>
                        </div>
                        <div class="gogroup f_c">去拼团</div>

                    </div>
                </li> -->
            </ul>
        </div>
        <div class="fenxiang_pop pop_Item dn">
            <div class="f_c fenxiang_pop_title">分享给</div>
            <ul class="fenxiangList plr">
                <li class="pyq"><i></i><span>朋友圈</span></li>
                <li class="weibo"><i></i><span>微博</span></li>
                <li class="qq"><i></i><span>QQ</span></li>
                <li class="facebook"><i></i><span>Facebook</span></li>
            </ul>
            <ul class="fenxiangList plr">
                <li class="wx bn"><i></i><span>微信</span></li>
                <!-- <li class="youxiang bn"><i></i><span>邮箱</span></li> -->
                <li class="clear bn"><i></i><span>生成分享图</span></li>
                <li class="copy bn"><i></i><span>复制链接</span></li>
            </ul>
            <div id="qrcode"></div>
            <a class="downcode dn" download="分享二维码">点击保存二维码</a>
            <div class="pop_close2 f_c">取消</div>
        </div>
        <div class="ps_pop pop_Item dn">
            <div class="pop_title">
                <span>配送方式 </span>
                <div class="pop_close2"><i class="icon"></i></div>
            </div>
            <ul class="psList plr">
                <!-- <li>
                    <div class="psBox1">
                        <div class="pstit f_c">仓存即送</div>
                    </div>
                    <div class="psBox2">此类商品存放于我们的货仓。订单一经确认，便立即进行捡货并安排最早时间送出。下午3点前下单，保证当日送到(邮寄订单，当日寄出)。下午3点后下单，我们会根据当天订单量及送货路线情况尽可能安排当日送达(寄出)，最晚第二天送达(寄出)。(注意：只适用于同一订单所有商品均有“仓存即送”标签)</div>
                </li>
                <li>
                    <div class="psBox1">
                        <div class="pstit f_c">仓存即送</div>
                    </div>
                    <div class="psBox2">此类商品存放于我们的货仓。订单一经确认，便立即进行捡货并安排最早时间送出。下午3点前下单，保证当日送到(邮寄订单，当日寄出)。下午3点后下单，我们会根据当天订单量及送货路线情况尽可能安排当日送达(寄出)，最晚第二天送达(寄出)。(注意：只适用于同一订单所有商品均有“仓存即送”标签)</div>
                </li> -->
            </ul>
        </div>
        <div class="kefu_pop pop_Item dn">
            <div class="kefu_title">客服</div>
            <div class="pop_close"></div>
            <div style="border-bottom:0.04rem solid #e1e1e1;width: calc(100% - 0.8rem);"></div>
            <div class="kefu_number">客服电话:<a></a></div>
            <div class="kefu_time"><span></span><div>工作时间(<label></label>)</div><span></span></div>
            <div class="kefu_email">客服邮箱:<span></span></div>
            <div class="kefu_tip">请扫描下方二维码添加客服微信进行咨询</div>
            <div class="kefu_qrcode"><img src="" /></div>
        </div>
  </div>
  <div class="xiala_popmask"></div>
  <div class="xiala_pop">
         <div class="xiala_Box">
             <div class="xiala_sj"></div>
             <ul>
                 <li onclick="gomsg()"><i></i>消息</li>
                 <li onclick="openWin('index','index.html')"><i></i>首页</li>
                 <li onclick="openWin('search','search.html')"><i></i>搜索</li>
                 <li onclick="gosc()"><i></i>我的关注</li>
             </ul>
         </div>   
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    var param='';
    var is_spell = false;
    var ware = {id:0,price:0,gid:0,jiage_type:0,is_tg:false,group_id:0}


    $(".pop_submit").click(function(){
        var num = $("#wareCount").val();

        // token   string  是   用户token
        // product_id  int 是   商品id
        // num int 是   商品数量
        // ggtc_id int 否   规格id
        // jiage_type
        if(!isLogin()){
            return;
        }
        if(ware.is_tg){//判断是否拼团
            var p ={buy_type:"spell",product_id:ware.id,num:num,ggtc_id:ware.gid,jiage_type:ware.jiage_type}
            if(ware.group_id !=0){
                p.group_id = ware.group_id;
            }
            pop.loading();
            getAjax(Interface.spell_have_stock,{token:token,product_id:ware.id,jiage_type:ware.jiage_type,num:num,ggtc_id:ware.gid},function(res){
                console.log(JSON.stringify(res));
                pop.close();
                if(res.status){
                    openWin('ware_order','ware_order.html',p);
                }else{
                    var msg = "库存不足";
                    if(cnen==2){
                        msg="Insufficient inventory";
                    }
                    pop.notice(msg);
                }
                
            },function(res,err){

            });
        }else{//不是拼团走购物车
            var p ={
                token:token,
                product_id:ware.id,
                num:num,
                ggtc_id:ware.gid,
                jiage_type:ware.jiage_type
            }
            pop.loading();
            getAjax(Interface.join_car,p,function(res){
                pop.close();
                //alert(JSON.stringify(res));
                maskClose();
                $(".pop_Item").addClass("dn");
                pop.notice(res.msg,1,function(){
                    //shoppingCart();
                });
            },function(res,err){

            });
        }


    })
    function goComment(){
        openWin('ware_comment','ware_comment.html',{id:ware.id});
    }
    $(window).scroll(function(e) {
        var startY = $(window).scrollTop();
        var t1 = $('#ware_1').offset().top;
        var t2 = $('#ware_2').offset().top;
        var t3 = $('#ware_3').offset().top;
        var t4 = $('#ware_4').offset().top;
        console.log(startY);
        ifxiala=true;
        $(".xiala_pop").fadeOut(300);
        $(".xiala_popmask").removeClass("on");
        if(startY < t2-100){
            console.log(t2);
            $(".titleItem").removeClass("on");
            $(".titleItem").eq(0).addClass("on");
        }else if(startY < t3 -100){
            console.log(t3);
            $(".titleItem").removeClass("on");
            $(".titleItem").eq(1).addClass("on");
        }else if(startY < t4 -100 && startY < t4 -400){
            $(".titleItem").removeClass("on");
            $(".titleItem").eq(2).addClass("on");
        }else{
            $(".titleItem").removeClass("on");
            $(".titleItem").eq(3).addClass("on");
        }
    });
    function onheightToTop(ele){
        var t = $('#ware_'+ele).offset().top;
        var top = 25;
        var sysType = api.systemType;
        if(sysType == 'ios'){
            top = 29;
        }else if(sysType == 'android'){
            top=24;
        }
        console.log(t);
        $(window).scrollTop(t+top-100);
    }
    function openGuiZe(){
        maskOpen();
        $(".groupGuiZe_pop").removeClass("dn");
    }
    var is_collect;
    var collect_id = 0;
    $(".favorite").click(function(){
        if(!isLogin()){
            return;
        }
        if(is_collect){
            pop.loading();
            getAjax(Interface.del_collect,{token:token,id:collect_id},function(res){
                pop.close();
                pop.notice(res.msg);
                 is_collect = false;
                $(".favorite").removeClass("on");
            },function(res,err){})
        }else{
            pop.loading();
            var p = {token:token,type:1,product_id:""+ware.id};
            getAjax(Interface.join_collect,p,function(res){
                console.log(JSON.stringify(res));
                pop.close();
                pop.notice(res.msg);
                collect_id = res.data;
                is_collect = true;
                $(".favorite").addClass("on");
            },function(res,err){})
        }
    })
    $(".cart").click(function(){
        shoppingCart();
    })
     
    $(".groupALLOpen").click(function(){
         maskOpen();
        $(".groupAll_pop").removeClass("dn");
    })
    $(".alone_buy").click(function(){
        ware.is_tg=false;
        ware.group_id =0;
        var son_price="";
        if(ware.old_price == ""){
            son_price+='<span>$'+ware.new_price+'</span>';
        }else{
            son_price+='<span>$'+ware.new_price+'</span>';
            son_price+='<del>'+ware.old_price+'</del>';
        }
        $("#son_price").html(son_price);
        buyWare();
    });
    $(".group_clear").click(function(){
        ware.is_tg=true;
        ware.group_id =0;
        var son_price="";
        if(ware.old_price == ""){
            son_price+='<span>$'+ware.new_price+'</span>';
        }else{

            son_price+='<span>$'+ware.new_price+'</span>';
            son_price+='<del>'+ware.old_price+'</del>';
        }
        if(ware.pin_price){
            son_price='<span>$'+ware.pin_price+'</span>';
            son_price+='<del>'+ware.old_price+'</del>';
        }
        $("#son_price").html(son_price);
        buyWare();
    });
    $(".addCart").click(function(){
        buyWare();
    });
    $(".pop_close2 .icon").click(function(){
        maskClose();
        $(".pop_Item").addClass("dn");
    });
    $(".pop_close").click(function(){
        maskClose();
        $(".pop_Item").addClass("dn");
    });
    $(".fx").click(function(){
        maskOpen();
        $(".fenxiang_pop").removeClass('dn');
    });

    /*客服*/
    var iskefu = true;
    $(".kefu").click(function(){
        if(iskefu){
            pop.loading();
            getAjax(Interface.kefu,{},function(ret){
                iskefu = false;
                $(".kefu_email span").html(ret.data.email);
                $(".kefu_number a").html(ret.data.mobile);
                 $(".kefu_number a").attr("href","tel:"+ret.data.mobile);
                $(".kefu_time div label").html(ret.data.work_time);
                $(".kefu_qrcode img").attr("src",getImg(ret.data.ewm_icon)).load(function(){
                    pop.close();
                    maskOpen();
                    $(".kefu_pop").removeClass("dn");
                });
            },function(res,err){})
            
        }else{
            maskOpen();
            $(".kefu_pop").removeClass("dn");
        }
        
    })
    $(".pop_close2").click(function(){
        maskClose();
        $(".pop_Item").addClass("dn");
    });
    var ifxiala =true;
    $(".xiala").click(function(){
        if(ifxiala){
            ifxiala=false;
           $(".xiala_pop").fadeIn(300); 
           $(".xiala_popmask").addClass("on");
       }else{
            ifxiala=true;
            $(".xiala_pop").fadeOut(300);
             $(".xiala_popmask").removeClass("on");
       }
    });
    $(".xiala_popmask").on('touchmove',function(){
        ifxiala=true;
        $(".xiala_pop").fadeOut(300);
        $(".xiala_popmask").removeClass("on");
    });
    $(".xiala_popmask").click(function(){
        ifxiala=true;
        $(".xiala_pop").fadeOut(300);
        $(".xiala_popmask").removeClass("on");
    });


    apiready = function(){
        $api.fixStatusBar($api.dom('header'));
        $api.fixStatusBar($api.dom('.xiala_pop'));
        
        api.addEventListener({
            name: 'reload'
        }, function(ret, err) {
           token = $api.getStorage('token');
           islogin=true;
        });
        api.setStatusBarStyle({
            color: '#fff',//设置APP状态栏背景色
            style: 'dark'
        });
        $(".ware_banner img").hide();
        ifCnAndEn();
        param = api.pageParam;
        ready();
        getps();
    };

    function buyWare(){
         maskOpen();
        $(".wareGuigePop").removeClass("dn");
    }
    var son_list;//规格
    var stock = 0;//库存
    function ready(){
        pop.loading();
        getAjax(Interface.details,{id:param.id,token:token},function(res){
            //console.log(JSON.stringify(res));
            pop.close();
            //is_spell
            // pop.loading();
            var info = res.data.info;
            var sendtype = res.data.sendtype;
            son_list =res.data.son_list;
            var comment_list = res.data.comment_list;//用户评论
            var guess_like = res.data.guess_like;//猜你喜欢
            var shop_hot = res.data.shop_hot;
            is_collect = res.data.is_collect;
            collect_id = res.data.collect_id;
            if(is_collect){
                $(".favorite").addClass("on");
            }
            //判断是否为拼团商品
            is_spell = info.is_spell;
            if(info.is_spell){
                ware.is_tg = true;
                $(".tuangouShow").removeClass('dn');
                $(".foot1").addClass("dn");
                $(".foot2").removeClass("dn");
                $(".group_clear span").eq(0).html("$"+info.pin_price);
                $(".alone_buy span").eq(0).html("$"+info.new_price);
                getRule();
                getGroup(info.id);
            }
            //商品详情
            if(cnen==2){
                info.title = info.egname;
            }
            $("#wareTitle").html(info.title);
            var price="";
            if(info.old_price == ""){
                price+='<span>$'+info.new_price+'</span>';
            }else{
                price+='<span>$'+info.new_price+'</span>';
                price+='<del>'+info.old_price+'</del>';
            }
            if(info.pin_price){
                price='<span>$'+info.pin_price+'</span>';
                price+='<del>'+info.old_price+'</del>';
            }
            $("#wareInfo_price").html(price);
            console.log(info.stock);
            stock = info.stock;
            //console.log(JSON.stringify(info.img_arr));
            if(info.img_arr){
                if(info.img_arr.length ==1){
                    $(".ware_banner img").attr("src",getImg(info.img_arr[0].path)).load(function(){
                        $(".ware_banner img").show();
                        // pop.close();
                    });
                }else{
                    var html = ""
                    $.each(info.img_arr,function(i,item){
                         html += '<div  class="swiper-slide"><img src="'+getImg(info.img_arr[i].path)+'" /></div>';
                    })
                    $(".ware_banner").html(html);
                    $(".ware_banner img").load(function(){
                        // pop.close();
                    });
                    var bannerSwiper = new Swiper('.ware_banner_swiper', {
                        loop : true,
                        //speed:1000,
                        observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                        observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                        pagination : '.swiper-pagination',
                        autoplayDisableOnInteraction: false,
                        touchMoveStopPropagation: false,
                    })
                }
                
            }else{
                $(".ware_banner img").attr("src",getImg(info.icon)).load(function(){
                  $(".ware_banner img").show();
                  pop.close();
                });
            }
            setTimeout(function(){
                pop.close();
            },5000)
           
            
            $(".score").html(info.ji_fen);
            $("#guige").html(info.norm);
            $("#wareps_tit").html(sendtype.title);
            $("#wareps_tit").addClass(getSend(sendtype.title));
            $("#zone").html(info.zone);
            
            $(".ps1").html(info.shop_name); 
            $(".ps2").html(info.ps_name); 
            $(".ps1").click(function(){
                openWin('shop','shop.html',{sdid:info.shop_id});
            })
            $(".ps2").click(function(){
                 openWin('shop','shop.html',{sdid:info.ps_id});
            })
            var stock_manage = info.stock_manage;
            var have_goods =info.have_goods;
            if(stock_manage == 1){//要管理 
                if(stock == 0){
                    $(".addCart").addClass("noStock");
                    $(".addCart").removeClass("addCart");
                    if(cnen==1){
                        $(".noStock").html("暂时无货");
                    }else{
                        $(".noStock").html("Out of Stock");
                    }
                }
            }else{
                if(have_goods == 2){
                    $(".addCart").addClass("noStock");
                    $(".addCart").removeClass("addCart");
                    if(cnen==1){
                        $(".noStock").html("暂时无货");
                    }else{
                        $(".noStock").html("Out of Stock");
                    }
                }
            }
            var boxUl ='';
            if(info.other_brief!="" && info.other_brief!=null){
                $.each(info.other_brief,function(i,item){
                    boxUl += '<li>'+item+'</li>';
                })
                $(".boxUl").html(boxUl);
                $("#brief").html(info.brief);
            }

            for(var i =0;i<5;i++){
                if(i<info.star_num){
                    $("#wareeva").append('<i class="on"></i>');
                }else{
                    $("#wareeva").append('<i class=""></i>');
                }
            }
            //$("#wareeva").append('<span id="total_score">('+info.total_score+')<span>');
            if(cnen==2){
                info.content = info.egcontent;
            }
            var whiletext = info.content;
            while(whiletext.indexOf('src="/Upload') != -1){
               var index = whiletext.indexOf('src="/Upload');
               var jq = whiletext.substring(index+5,index+11);
               var jq2 = whiletext.substring(0,index+5);
               var jq3 = whiletext.substring(index+11,whiletext.length);
               whiletext =jq2 +getImg(jq) +jq3;
            }
            //console.log(whiletext);
            $(".wareContent").html(whiletext);
            //用户评论
            //console.log('用户评论');
            //console.log(JSON.stringify(comment_list.list));

            if(comment_list.list != "" && comment_list.list !=null){
                var html = '';
                $.each(comment_list.list,function(i,item){
                    
                        html += '<li><div class="evaBox1 displayFlex">';
                            html += '<div class="userinfo">';
                                    html += '<div class="userImg">';
                                            html += '<img src="'+getImg(item.icon)+'" />';
                                        html += '</div>';
                                        if(!item.username){
                                            if(item.mobile.length == 11){
                                                var mobile = item.mobile.substr(0,3)+"****"+item.mobile.substr(7);
                                                item.username = mobile;
                                            }else{
                                                item.username = "匿名用户";
                                                if(cnen==2){
                                                    item.username ='Anonymous User';
                                                }
                                            }
                                        }
                                        html += '<div class="userName">'+item.username+'</div>';
                                        html += '<div class="evaLvl ">';
                                        for(var index = 0; index<item.star;index++){
                                            html+='<i class="on"></i>';
                                        }
                                        html += '</div>';
                                    html += '</div>';
                                    html += '<div>'+timestampToTime(item.create_time)+'</div>';
                                html += '</div>';
                                html += '<div class="evaBox2">'+item.content+'</div>';
                                html += '<div class="evaBox4">';
                                    // <img src="../image/ware_2.png" />
                                    // <img src="../image/ware_3.png" />
                                html += '</div>';
                               // html += '<div class="evaBox5">2斤约12个</div>';
                            html += '</li>';
                })
                $(".evaList").html(html);
            }
            $("#comment_count").html("("+comment_list.total_count+")");
            //console.log(JSON.stringify(guess_like));
            if(guess_like!=null && guess_like.length > 0 && guess_like!=""){
                var html ='';
                $.each(guess_like,function(i,item){
                    if(i==0){//每三个是一个swiper
                        html +='<div class="swiper-slide">';
                    }
                    html +=getWare(item);
                    if((i+1)%6 == 0 ||(i+1)==guess_like.length){//判断一个swiper里面有几个数据
                        if((i+1)==guess_like.length){
                            html +='</div>';
                        }else{
                            html +='</div><div class="swiper-slide">';
                        }
                    }
                })
                $(".like_swiper .swiper-wrapper").append(html);
                var like_swiper = new Swiper('.like_swiper', {
                   pagination : '.swiper-pagination',
                });
            }else{
                $(".like_ware").hide();
            }
            if(shop_hot!=null && shop_hot.length > 0 && shop_hot!=""){
                var html ='';
                $.each(shop_hot,function(i,item){
                    if(i==0){//每三个是一个swiper
                        html +='<div class="swiper-slide">';
                    }
                    html +=getWare(item);
                    if((i+1)%3 == 0 ||(i+1)==shop_hot.length){//判断一个swiper里面有几个数据
                        if((i+1)==shop_hot.length){
                            html +='</div>';
                        }else{
                            html +='</div><div class="swiper-slide">';
                        }
                    }
                })
                $(".hot_swiper .swiper-wrapper").append(html);
                var hot_swiper = new Swiper('.hot_swiper', {
                   pagination : '.swiper-pagination',
                });
            }else{
                $(".hot_ware").hide();
            }
            $("#son_title").html(son_list.pro_chanpin_info.title);
            $("#son_img").attr("src",getImg(son_list.pro_chanpin_info.icon));
            var son_price="";
            ware.old_price = info.old_price;
            ware.new_price = info.new_price;
            ware.pin_price = info.pin_price;
            if(info.old_price == ""){
                son_price+='<span>$'+son_list.pro_chanpin_info.new_price+'</span>';
            }else{
                son_price+='<span>$'+son_list.pro_chanpin_info.new_price+'</span>';
                son_price+='<del>'+son_list.pro_chanpin_info.old_price+'</del>';
            }
            $("#son_price").html(son_price);
            ware.jiage_type = son_list.jiage_type;
            ware.id=son_list.pro_chanpin_info.id;
            if(son_list.jiage_type==0){
                // $(".guiGeList").append('<li class="on">'+son_list.pro_chanpin_info.title+'</li>');
                $(".ggpopBox1").hide();
                ware.price=son_list.son_price;
            }else{
                //console.log(JSON.stringify(son_list.son));
                $.each(son_list.son,function(i,item){
                    if(i==0){
                        $(".guiGeList").append('<li onclick="chooseGuige(this,\''+i+'\')" class="on">'+item.title+'</li>');
                        ware.gid=item.id;

                    }else{
                        $(".guiGeList").append('<li onclick="chooseGuige(this,\''+i+'\')">'+item.title+'</li>');
                    }
                })

            }
            
        },function(ret,err){

        })
    }

    function getSend(title){
        if(title=="当日送达" || title=="Same-day Delivery"){
            return"t1";
        }else if(title=="三日送达" || title=="3-day Delivery"){
            return"t2";
        }else if(title=="商家派送" || title=="Merchant Delivery"){
            return"t3";
        }else if(title=="海外集运" || title=="Overseas Delivery"){
            return"t4";
        }else if(title=="预购待送" || title=="Pre-order"){
            return"t5";
        }else if(title=="电子优惠券" || title=="E-Coupon"){
            return"t6";
        }else{
            return"t1";
        }
    }
    $("#wareps_tit").click(function(){
        maskOpen();
        $(".ps_pop").removeClass("dn");
    })

    //选择规格
    function chooseGuige(e,index){
        $(".guiGeList li").removeClass("on");
        $(e).addClass("on");
        var son = son_list.son[index];
        $("#son_price").html('<span>$'+son.price+'</span>');
        ware.gid=son.id;
        //ware.price=son.price;
    }
    //数量加减
    $("body").on("click", ".count_control .reduce",function(){
        // if(ware.is_tg){
        //     return;
        // }
        var val = $(this).next().find("input").val();
         console.log(val);
        if(val ==1){
            if(cnen==1){
                pop.notice('数量不能小于1');
            }else{
                pop.notice('Count should not be < 1');
            }
            return;
        }else{
            val= Number(val)-Number(1);
            $(this).next().find("input").val(val);
        }
        console.log(val);
    });
    $("body").on("click", ".count_control .add",function(){
        // if(ware.is_tg){
        //     return;
        // }
        var val =$(this).prev().find("input").val();
         console.log(val);
        val= Number(val)+Number(1);
        console.log(stock);
        if(stock < val){
            if(cnen == 1)
            pop.notice('没有更多的库存了！');
            else
            pop.notice('Not more stock！');
            return ;
        }
        $(this).prev().find("input").val(val);
    });

    //拼团规则
    function getRule(){
        getAjax(Interface.spell_rule,{},function(res){
            $(".guize_content").html(res.data.content);
        })
    }

    function getGroup(id){
        getAjax(Interface.spell_group,{product_id:id},function(res){
            console.log(JSON.stringify(res));
            var list  =res.data;
            if(list){
                $("#group_pe").html(list.length);
                $.each(list,function(i,item){
                    if(i < 2){
                        $("#groupList").append(getgroupList(item));
                    }
                    $("#pop_groupList").append(getgroupList(item,'plr'));
                })
                if(cnen ==1){

                }else{
                     getCountDown(".surplus",'');
                }
            }else{
                $("#group_pe").html(0);
            }
        },function(res,err){})
    }

    function getgroupList(item,styles){
        var user = item.user[0];
        var c = Number(item.total_num) - item.user.length;
        var html='  <li class="'+styles+'">';
            html+='<div class="groupUserItem1">';
                html+='<div class="groupUserTx"><img src="'+getImg(user.icon)+'" /></div>';
                html+='<div class="">'+user.username+'</div>';
            html+='</div>';
            html+='<div class="groupUserItem1">';
                html+='<div class="groupCount">';
                    if(cnen==1){
                         html+='<div>还差<span class="c_main">'+c+'人</span>拼成</div>';
                    }else{
                          html+='<div><span class="c_main">'+c+'</span> more to make the deal</div>';   
                    }
                    html+='<div data-time="'+item.end_time+'" class="surplus"></div>';
                html+='</div>';
                if(cnen==1){
                     html+='<div onclick="gogroup('+item.id+',\''+user.username+'\')" class="gogroup f_c">去拼团</div>';
                }else{
                    html+='<div onclick="gogroup('+item.id+',\''+user.username+'\')" class="gogroup f_c">Join</div>';
                }
            html+='</div>';
        html+='</li>';
        return html;
    }
    function gogroup(id,name){
        $(".joinGroup_pop .pop_title span").html('参与'+name+'的团');
        $("#ware_group").data("id",id);
        pop.loading();
         getAjax(Interface.group_user,{id:id},function(res){
            //console.log(JSON.stringify(res));
            var com_num = res.data.total_num;
            var user = res.data.user;
            state = res.data.state;
            $(".msdjs .c_main").html(com_num-user.length);;
            var html='';
            for(var i = 0;i<com_num;i++){
                if(i<user.length){
                    if(i==0){
                        html+='<li>';
                            html+='<div class="pinzhu">拼主</div>';
                            html+='<img src="'+getImg(user[i].icon)+'"/>';
                        html+='</li>';
                    }else{
                        html+='<li>';
                            html+='<img src="'+getImg(user[i].icon)+'"/>';
                        html+='</li>';
                    }
                }else{
                    html+='<li>';
                        html+='<img src="../image/user_no.png"/>';
                    html+='</li>';
                }
            }
            $(".groupUsetList").html(html);
            clearInterval(timer);
            pop_timeDown(res.data.end_time);

        },function(res,err){})
        
    }
    $("#ware_group").click(function(){
        ware.is_tg=true;
        ware.group_id =$(this).data("id");
        var son_price="";
        if(ware.old_price == ""){
            son_price+='<span>$'+ware.new_price+'</span>';
        }else{

            son_price+='<span>$'+ware.new_price+'</span>';
            son_price+='<del>'+ware.old_price+'</del>';
        }
        if(ware.pin_price){
            son_price='<span>$'+ware.pin_price+'</span>';
            son_price+='<del>'+ware.old_price+'</del>';
        }

        $("#son_price").html(son_price);
        maskClose();
        $(".pop_Item").addClass("dn");
        buyWare();
    })

    function getps(){
        getAjax(Interface.shipping_way,{},function(res){
            var html ='';
            $.each(res.data,function(i,item){
                var style =  getSend(item.title);
                if(cnen==2){
                    item.title = item.egname;
                    item.content = item.egcontent;
                }
                 html +='<li>';
                    html +='<div class="psBox1">';
                        html +='<div class="pstit '+style+' f_c">'+item.title+'</div>';
                    html +='</div>';
                    html +='<div class="psBox2">'+item.content+'</div>';
                html +='</li>';
            })
            $(".psList").html(html);
        },function(res,err){})
    }


    $(".pyq").click(function(){
        var p = {
            apiKey: '',
            scene: 'timeline',
            title:$("#wareTitle").text(),
            thumb:ajaxUrl.url + '/Public/Home/images/logo_ios.png',
            contentUrl:ajaxUrl.url +'/mobile/html/ware.html?id='+param.id,
        };
        wxpyqFX(p);
    })
    $(".wx").click(function(){
        var p = {
            apiKey: '',
            scene: 'session',
            title:$("#wareTitle").text(),
            thumb:ajaxUrl.url + '/Public/Home/images/logo_ios.png',
            contentUrl:ajaxUrl.url +'/mobile/html/ware.html?id='+param.id,
        };

        wxpyqFX(p);
    })
    $(".weibo").click(function(){
        var p = {
            title:$("#wareTitle").text(),
            text:$("#wareTitle").text(),
            thumb:ajaxUrl.url + '/Public/Home/images/logo_ios.png',
            contentUrl:ajaxUrl.url +'/mobile/html/ware.html?id='+param.id,
        }
        weibo_authorize(p);
    })
    $(".qq").click(function(){
        var p = {
            url: ajaxUrl.url +'/mobile/html/ware.html?id='+param.id,
            title: $("#wareTitle").text(),
            description: $("#wareTitle").text(),
            imgUrl: ajaxUrl.url + '/Public/Home/images/logo_ios.png',
        }
        qqfx(p);
    })
    
    $(".facebook").click(function(){
        console.log('fb分享');
       var p =  {
            url: ajaxUrl.url +'/mobile/html/ware.html?id='+param.id,
            imgUrl: ajaxUrl.url + '/Public/Home/images/logo_ios.png',
            description: '',
            title: $("#wareTitle").text(),
        };
        fackBookFX(p);
    })
    var clipboard = new Clipboard('.copy', {
        text: function() {
            return ajaxUrl.cnurl +"/mobile/html/ware.html?id="+param.id;
        }
    });
    clipboard.on('success', function(e) {
        pop.notice("链接复制成功");
    });
 
    clipboard.on('error', function(e) {
        console.log(e);
    });
    $(".clear").click(function(){
        console.log($('#qrcode').find('canvas').length)
        if($('#qrcode').find('canvas').length <1){
            var qrcode= $('#qrcode').qrcode(ajaxUrl.cnurl +"/mobile/html/ware.html?id="+param.id);   
            var canvas=qrcode.find('canvas').get(0);  
            $('.downcode').attr('href',canvas.toDataURL('image/jpg'));
            // $('.downcode').removeClass('dn');
        }
    })

    function timestampToTime(timestamp) {
    //时间戳为10位需*1000，时间戳为13位的话不需乘1000
        var date = new Date(timestamp * 1000);
        Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
        h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours())+ ':';
        m = (date.getMinutes()< 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':';
        s = date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds();
        return Y+M+D;
    }

    //倒计时
    var timer;
function pop_timeDown(timestamp){
        timer = setInterval(function(){
            //var nowTime = Date.parse( new Date() ).toString();
            var endTime = timestamp+"000";
            var nowTime = new Date();
 
            var t = endTime - nowTime.getTime()
            //var t = endTime - nowTime.substr(0,10);
            if(t <= 0){
                clearInterval(timer);
                $(".djstime.hh").html("00");
                $(".djstime.mm").html("00");
                $(".djstime.ss").html("00");
                return false;
            }
            // var d=Math.floor(t/1000/60/60/24);
            var hour=Math.floor(t/1000/60/60%24);
            var min=Math.floor(t/1000/60%60);
            var sec=Math.floor(t/1000%60);
            if (hour < 10) {
                 hour = "0" + hour;
            }
            if (min < 10) {
                 min = "0" + min;
            }
            if (sec < 10) {
                 sec = "0" + sec;
            }
            $(".djstime.hh").html(hour);
            $(".djstime.mm").html(min);
            $(".djstime.ss").html(sec);
        },1000);
        pop.close();
        maskClose();
        $(".pop_Item").addClass("dn");
        maskOpen();
        $(".joinGroup_pop").removeClass("dn");
}
</script>
<script type="text/javascript">
    function ifCnAndEn(){
        if(cnen==2){
            $(".headerTitle .titleItem").eq(0).html('Item<i></i>');
            $(".headerTitle .titleItem").eq(1).html('Reviews<i></i>');
            $(".headerTitle .titleItem").eq(2).html('Details<i></i>');
            $(".headerTitle .titleItem").eq(3).html('Recommended<i></i>');
            $(".waregz").html('You will earn <span class="score">2</span> points for buying this item');
            $(".boxItem1 .boxtitle").eq(0).html('Origin');//产地;
            $(".boxItem1 .boxtitle").eq(1).html('Packing Spec');//规格;
            $(".boxItem2 .boxtitle").eq(0).html('Description');//简介
            $(".wareBox3 .boxItem1 ").eq(0).html('Sold by<span id="ps1" class="ps1">HAVEIT.CA</span> | Shipped by<span id="ps2" class="ps2">HAVEIT.CA</span>');//配送方式
            $(".boxItem2 .boxtitle").eq(1).html('Other Info');//送货
            $(".move").html("More"+'<i class="icon"></i>');
            $(".favorite span").html('Wish list');
            $(".kefu span").html('Help');   
            $(".cart span").html('Cart');
            $(".addCart").html('Add to Cart');
            $("#plEn").html('Reviews');
            $("#dlEn").html('Details');
            $("#glEn").html('You May Also Like');
            $("#hotEn").html('Stores Hot');
            
            $(".ggpopBox1").html('Choose Specs');
            $(".pop_wareCount div").eq(0).html('Choose Count');
            $(".alone_buy span").html("Buy now");
            $(".group_clear span").html("Start a deal");
            $(".pop_submit").html("Add to cart");
            $(".ptgz").html('Start a deal and invite friends to join you.<span class="openGuiZe" onclick="openGuiZe();">View rules</span>');
            $(".group_titles").html('Join the ongoing deals');
            $(".pop_title").eq(0).find("span").html('Group Deals Rules');
            $(".pop_title").eq(2).find("span").html('Ongoing Deals');
            $(".pop_title").eq(3).find("span").html('Delivery Methods');
            $(".xiala_Box ul li").eq(0).html("<i></i>Message");
            $(".xiala_Box ul li").eq(1).html("<i></i>Index");
            $(".xiala_Box ul li").eq(2).html("<i></i>Search");
            $(".xiala_Box ul li").eq(3).html("<i></i>Wish");

            $(".kefu_title").html('Customer Service');
            $(".kefu_number").html('Phone: <a></a>');
            $(".kefu_time div").html('Hours: (<label></label>)');
            $(".kefu_email").html('Email:&nbsp;<span></span>');
            $(".kefu_tip").html('Please scan below QR code to talk with us on WeChat');

            $(".pyq span").html("Moment");
            $(".weibo span").html("Weibo");
            $(".wx span").html("WeChat");
            $(".clear span").html("QR Code");
            $(".copy span").html("Link");
            $(".fenxiang_pop_title").html('Share to');
            $(".pop_close2").eq(4).html('Cancel');
        }
    }
</script>
</html>
